<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Trawind\Extension\Models\Deploy\Language;

class CreateDeployLanguagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('deploy_languages', function (Blueprint $table) {
            $table->integer('id')->unique()->comment('id');
            $table->tinyInteger('origin_type_id')->default(1)->comment('来源类型');
            $table->string('business_type')->comment('关联单据');
            $table->integer('business_id')->comment('关联id');
            $table->string('field',64)->comment('字段');
            $table->string('language',20)->default(Language::DEFAULT_LANGUAGE)->comment('语言');
            $table->string('content')->comment('翻译内容');

            $table->index(['business_type','business_id']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('deploy_languages');
    }
}
